package com.pingxx.demo.config;

import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.zookeeper.lock.ZookeeperLockRegistry;

@Configuration
public class ZookeeperConfig {

//    @Value("${spring.zookeeper.server}")
//    private String connectString;
//
//    @Bean
//    public CuratorFramework curatorFramework() {
//        RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
//        CuratorFramework curatorFramework = CuratorFrameworkFactory.newClient(connectString, retryPolicy);
//        curatorFramework.start();
//        return curatorFramework;
//    }
//
//
//    @Bean
//    public ZookeeperLockRegistry zookeeperLockRegistry(CuratorFramework curatorFramework) {
//        ZookeeperLockRegistry zookeeperLockRegistry = new ZookeeperLockRegistry(curatorFramework);
//        return zookeeperLockRegistry;
//    }
}
